package net.ycxinxing.mcpebox;

import android.os.Bundle;
import android.support.design.widget.AppBarLayout;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.Toast;
import net.ycxinxing.mcpebox.Pro.R;
import android.graphics.Color;
import android.widget.RadioGroup.LayoutParams;

public class baseActivity extends AppCompatActivity
{
	Toolbar toolbar;
	AppBarLayout layout;
	public Toolbar getToolbar()
	{
		return toolbar;
	}
	public AppBarLayout getToolBarLayout()
	{
		return layout;
	}
    @Override
    protected void onCreate(Bundle savedInstanceState)
    {
		//setTheme(R.style.AppTheme);
        super.onCreate(savedInstanceState);
		toolbar=new Toolbar(this);
		layout=new AppBarLayout(this);
    }
	public void toast(final String str)
	{
		this.runOnUiThread(new Runnable(){
				@Override
				public void run()
				{
					Toast.makeText(baseActivity.this,str,Toast.LENGTH_SHORT).show();
					// TODO: Implement this method
				}
			});
		log("Toast:"+str);
	}
	public static void log(String str)
	{
		Log.d("mcpebox", str);
	}

	@Override
	public void setContentView(View view)
	{
		LinearLayout mainview=new LinearLayout(this);
		
		layout.addView(toolbar);
		mainview.addView(layout);
		//layout.getLayoutParams().height=Utils.dip2px(this,56);
		layout.getLayoutParams().width=LayoutParams.MATCH_PARENT;
		mainview.setOrientation(1);
		mainview.addView(view);
		setSupportActionBar(toolbar);
		// TODO: Implement this method
		super.setContentView(mainview);
	}

	@Override
	public void setContentView(int layoutResID)
	{
		setContentView(LayoutInflater.from(this).inflate(layoutResID,null));
	}
	
}
